﻿@model IEnumerable<DLM.Domain.DTO.FriendDTO>
@using DLM.Domain.Model;
@using Webdiyer.WebControls.Mvc;
<script type="text/javascript">
    $(document).ready(function () {
        $("ul.clearfix li").mouseover(function () {

            $(this).addClass("hover");
        });
        $("ul.clearfix li").mouseout(function () {

            $(this).removeClass("hover");
        });
        $("a").css("cursor", "pointer");
    });

    function confirmFriend(id) {
        var request = $.ajax({
            type: "POST",
            url: "/Friend/Agree/",
            data: { id: id },
            success: function (data, textStatus) {
                //$(".ajax.ajaxResult").html("");
                //$("item", data).each(function (i, domEle) {
                //$(".ajax.ajaxResult").append("<li>" + $(domEle).children("title").text() + "</li>");
                //});
                $("#divFriendRequest").html(data);
                //$("#divFriend").load("/Friend/LoadMyFriend");
                ShowDialogMessage('right', "您的操作成功了，请等待该会员的回应！");
            },
            error: function () {
                ShowDialogMessage('error', "您的操作失败了，请重试！");
            }
        }).done(function (msg) {

        });


    }
</script>
<h3>
    好友请求列表<a>总共 @Model.Count() 名</a></h3>
<div class="tr clearfix">
    <div class="friend_list">
        <ul class="clearfix">
            @foreach (var item in Model)
            {
                
                <li>
                    <div class="friend_item">
                        <div class="friend_pic">
                            <a href="">
                                @if (item.FriednPhoto == "none_75_75.png")
                                {
                                    <img src="@Url.Content("~/Content/ad/none_75_75.png")" alt="头像" height="77px" width="77px"/>
                                }
                                else
                                { 
                                    <img src="@Url.Content("~/Files/Photos/" + item.UserID + "/" + item.FriednPhoto)" />
                                }
                            </a>
                        </div>
                        <div class="friend_info">
                            <a href="">@item.FriendAccount</a></div>
                        <div class="friend_act">
                            <div class="friend_act_left">
                                <a href="@Url.Action("View", "User", new { id = item.UserID })">查看资料</a>
                            </div>
                @*            @if (!item.IsConfirmed)
                            { <div class="friend_act_right">
                                    @using (Ajax.BeginForm("Agree", "Friend", new { id = item.FriendID }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "divFriendRequest", OnSuccess = "onInvitateSuccessed", OnFailure = "onInvitateFalied" }))
                                    {
                             
                                        <input type="submit" value="同意" class="btn" />
                   
                                    }
                                </div>
                            }*@
                             <a onclick="confirmFriend(@item.FriendID)">接受</a>
                        </div>
                    </div>
                </li>
               
            }
        </ul>
        <div class="paging">
                @Ajax.Pager(Model as PagedList<DLM.Domain.DTO.FriendDTO>, new PagerOptions
                {
                    PageIndexParameterName = "requestid",
                    CurrentPagerItemWrapperFormatString = "<span class=\"current\">{0}</span>",
                    //NumericPagerItemWrapperFormatString = "<a>{0}</a>",
                    PrevPageText = "<",
                    NextPageText = ">",
                    ShowNumericPagerItems = true,
                    ShowFirstLast = false,
                    ShowPrevNext = true,
                    CssClass = "scott",
                    MorePageText = "...",
                    SeparatorHtml = ""
                },
                 new AjaxOptions { UpdateTargetId = "divFriendRequest" }
            )
    </div>
</div>
</div>
